package Utils;

import java.util.ArrayList;
import java.util.List;

import junit.framework.Assert;

public class Logger {
	private List<ILoggable> _listTargert = new ArrayList<ILoggable>();
	
	public void addTarget(ILoggable target)
	{
		Assert.assertNotNull("target cannot be null", target);
		_listTargert.add(target);
	}
	
	public void removeTarget(ILoggable target)
	{
		Assert.assertNotNull("target cannot be null", target);
		_listTargert.remove(target);
	}
	
	public void pushMessage(String message)
	{
		for (int i = 0; i < _listTargert.size(); i++)
			_listTargert.get(i).logReceived(message);
	}
	
	public interface ILoggable {
	    public void logReceived(String message);
	}
}


